<template>
    <view class="page-content" style="background:#F6F6F6;">
        <navbar @clickLeft="toBack" fixed leftIcon="left" title="创建钱包" shadow></navbar>
        <view class="m-t-30 p-l-30 p-r-30">
            <view class="line">
                <view class="c_3c3 fz-16 title">设置钱包名称</view>
                <uni-easyinput v-model="walletName" placeholder="请输入您的钱包名称" class="us-input"></uni-easyinput>
            </view>
            
            <view class="line">
                <view class="c_3c3 fz-16 title">设置密码</view>
                <uni-easyinput v-model="password" type="password" placeholder="密码不少于6位数，请务必牢记" class="us-input"></uni-easyinput>
                <uni-easyinput v-model="repeatPassword" type="password" placeholder="重复密码" class="us-input m-t-15"></uni-easyinput>
            </view>
            
            <!--<view class="line">
                <view class="c_3c3 fz-16 m-b-13">提示信息</view>
                <uni-easyinput v-model="pwdTips" placeholder="密码提示信息(可不填)" class="us-input" ></uni-easyinput>
            </view>

             <label class="view flex-row align-center">
                <view class="m-r-8">
                    <radio  />
                </view>
                <view class="c_3c3">我已仔细阅读并同意<span style="color:#6781FF;">《用户协议》</span></view>
            </label>-->
			<view class="line text-grey">
			    温馨提示：<br />
				<view class="break-word">神龙钱包不会存储用户密码，无法提供密码找回功能和重置功能，请合理设置密码强度，并妥善保管密码</view>
			</view>
            <el-button @click="beginCreate" class="btn-c" block style="border-radius: 12px !important;" type="primary">创建钱包</el-button>
        </view>
    </view>
</template>

<script>

import navbar from '@/components/uni-nav-bar'
import  uniEasyinput from '@/components/uni-easyinput/uni-easyinput'
import elButton from '@/components/el-button/el-button'
import noData from '@/components/noData/noData'
import sibList from '@/components/sib-list/sib-list.vue'

import { aboutWallet, formatMnemonicWords} from "@/common/businessCommon";
import { mapState, mapGetters } from 'vuex';
import EasyDialog from "@/components/EasyDialog";
import { mapMutations } from 'vuex'

export default {
    components: {
      navbar,
      uniEasyinput
	},
    data() {
        return {
          walletName: '',
          password: '',
          repeatPassword: '',
          rePwd: ''
        }
    },
	onShow() {
	  
	},
    methods: {
		...mapMutations(['saveNameAndPassword']),
		beginCreate() {
			if(!this.walletName) {
				uni.showToast({
					title:"请输入钱包名称",
					icon: "none"
				})
				return false
			}
			if(!this.password || this.password.length < 6) {
				uni.showToast({
					title:"请输入钱包密码且不少于6位",
					icon: "none"
				})
				return false
			}
			if(!this.repeatPassword) {
				uni.showToast({
					title:"请再次输入钱包密码",
					icon: "none"
				})
				return false
			}
			if(this.password != this.repeatPassword) {
				uni.showToast({
					title:"两次密码不一致,请重新输入",
					icon: "none"
				})
				return false
			}
			let data = {
				walletName: this.walletName,
				password: this.password
			}
			this.saveNameAndPassword(data)
			uni.navigateTo({
				url: "/pages/wallet/mnemonic/index"
			})
		},
		toBack(){
			console.log('back');
			uni.navigateBack();
		}
    }
    
};
</script>

<style lang="scss" scoped>
.bar1-title {
    color:#3C3C3C;
    font-size: 32rpx;
}

page {
    background: #F6F6F6;
}
.line{
	margin-bottom: 30px;
	.title{
		margin-bottom: 6px;
	}
	.break-word{
		font-size: 14px;
		word-break: break-all;
		white-space: normal;
	}
	.uni-easyinput{
		font-size: 14px;
	}
}
.text-grey{
	color:#999999;
}
.left-bar-item {width: 100%;height:68px;display: flex;align-items: center;justify-content: center;}
.left-bar-item .image{
    width:30px;
    height: 30px;
}
.left-bar-item.active {
    background: #F6F6F6;
}
.btn-c {
    display: block;
    margin-top:56rpx;
    width: 100%;
    height: 96rpx;
    line-height: 78rpx;
    font-size: 40rpx;
}
.fix-bottom {width: 100vw;height: 100px;background: #fff;bottom: 0;left: 0;padding-top:32rpx;position: fixed;}
</style>
